home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12843 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: cs.uwa.edu.au!gordon
  2. From: gordon@cs.uwa.edu.au (Gordon Royle)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Does C convert float to double internally ?
  5. Date: 3 Apr 96 02:03:35 GMT
  6. Organization: The University of Western Australia
  7. Message-ID: <gordon.828497015@cs.uwa.edu.au>
  8. References: <4jsllh$hkf@harbinger.cc.monash.edu.au>
  9. NNTP-Posting-Host: wallaroo.cs.uwa.oz.au
  10. X-Newsreader: NN version 6.5.0 #3 (NOV)
  11.  
  12. bcheung@yoyo.cc.monash.edu.au (Biggles Cheung) writes:
  13.  
  14. >I was told that C compiler automatically converts "float" variable
  15. >internally to "double" for + - * / , etc operations. Is this true?
  16.  
  17. >Can I force the C compiler not to do the conversion as I have an
  18. >assignment on finding out various computing errors of different
  19. >precisions? 
  20.  
  21. >My advice from the lecturer is to have temporary variable of
  22. >float to split a long equation to smaller step so that I can maximize
  23. >the impact of single precision number on the evaluation. Is this
  24. >feasible?
  25.  
  26. If I were you I would write a quick set of routines that performs
  27. arithmetic to a fixed number of decimal places by simulating rational
  28. numbers with denominators of 100, or 1000 or 10000.
  29.  
  30. I tried once to give my students a project on numerical inaccuracy and 
  31. found that it was hard to make any sensible sized examples show really
  32. bad behaviour, without limiting the number of decimal points to 2 or 3.
  33.  
  34. gordon
  35. -- 
  36. Gordon Royle ---- gordon@cs.uwa.edu.au
  37. Visit http://www.cs.uwa.edu.au/~gordon
  38. --
  39.